/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufpe.cin.dsoa.visualvm.persistence;

import br.ufpe.cin.dsoa.visualvm.domain.QoSCharacteristic;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;



/**
 *
 * @author rafael.lima
 */
public class CharacteristicDAO {

	private Collection<QoSCharacteristic> characteristics;
	
	public CharacteristicDAO(){
		
		this.characteristics = new Vector<QoSCharacteristic>();
		
	}
	
    public void add(QoSCharacteristic mon) {
    	this.characteristics.add(mon);
    	
    }

    public void update(String characteristic, QoSCharacteristic qosCharacteristic) {
       //need tells to servicemonitoring view that is a
    	
    	QoSCharacteristic actual = this.getCharacteristic(characteristic);
    	actual.setName(qosCharacteristic.getName());
    }

	public QoSCharacteristic getCharacteristic(String characteristic) {
		
		QoSCharacteristic ret = null;
		Iterator<QoSCharacteristic> it = this.characteristics.iterator();
		
		
		boolean stop = false;
		QoSCharacteristic temp = null;
		//QoSCharacteristic comparator = new QoSCharacteristic(characteristic);
		//while(!stop && it.hasNext()){
		//	temp = it.next();
		//	stop = temp.equals(comparator);
		//}
	
		//if(stop)
		//	ret = temp;
		
		return ret;
	}

	public Collection<QoSCharacteristic> getAll() {
		return this.characteristics;
	}

	public void remove(String selectedItem) {
		
		//this.characteristics.remove(new QoSCharacteristic(selectedItem));
		
	}

	public boolean contains(QoSCharacteristic characteristic) {
		
		return this.characteristics.contains(characteristic);
	}

   
    
}
